﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Form2 : Form
    {
        DataSet hospitalDataSet;
        public Form2(DataSet datasetInput)
        {
            InitializeComponent();
            hospitalDataSet = datasetInput;
            int i = 0;
            foreach (DataRow row in hospitalDataSet.Tables["bacsi"].Rows)
            {
                if ((int)row["id"] == i)
                    i++;
                else
                    break;
            }
            this.textBox1.Text = i.ToString();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            DataRow NewRow = hospitalDataSet.Tables["bacsi"].NewRow();
            NewRow["id"] = this.textBox1.Text;
            NewRow["ten"] = this.textBox2.Text;
            hospitalDataSet.Tables["bacsi"].Rows.Add(NewRow);
        }
    }
}
